<%--@elvariable id="note" type="com.genghis.ptas.note.entity.Note"--%>
<%--@elvariable id="typeValueList" type="java.util.List"--%>
<%--@elvariable id="typeValue" type="com.genghis.ptas.classify.entity.TypeValues"--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <%@include file="../../common.jsp" %>
    <!-- BEGIN PAGE LEVEL STYLES -->
    <link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.css"/>
    <link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
    <!-- END PAGE LEVEL STYLES -->

    <!-- BEGIN THEME STYLES -->
    <link href="assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/plugins.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color"/>
    <link href="assets/css/custom.css" rel="stylesheet" type="text/css"/>
    <!-- END THEME STYLES -->
    <style type="text/css">
        .page-content {
            margin-left: 0 !important;
        }

        body {
            background-color: white !important;
        }

        .row {
            margin: 0 !important;
        }
    </style>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body>
<!-- BEGIN CONTAINER -->
<div class="page-content">
    <div class="row">
        <div class="col-md-12">
            <div class="col-md-6">
                <label class="control-label col-md-3">课件分类：</label>
                <select class="form-control input-medium select2me"
                        data-placeholder="${note.showNoteType}">
                    <c:forEach var="typeValue" items="${typeValueList}">
                        <option value="${typeValue.id}">${typeValue.typeValue}</option>
                    </c:forEach>
                </select>
            </div>
            <div class="col-md-6">
                <div class="input-group input-medium pull-right">
                    <input id="noteName" type="text" class="form-control input-medium" placeholder="${note.noteName}">
                    <span class="input-group-btn">
                        <button class="btn green" onclick="addNote()" title="保存笔记"><i class="fa fa-save"></i></button>
                    </span>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <label for="edit${note.id}"></label>
            <textarea style="height: 200px"
                      class="wysihtml5 form-control"
                      id="noteContent"
                      rows="6">
                ${note.noteContent}
            </textarea>
        </div>
    </div>
</div>
<!-- END CONTAINER -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="assets/plugins/respond.min.js"></script>
<script src="assets/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap/js/bootstrap2-typeahead.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<script type="text/javascript" src="assets/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-wysihtml5/wysihtml5-0.3.0.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.js"></script>
<script src="assets/plugins/bootstrap-markdown/lib/markdown.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-markdown/js/bootstrap-markdown.js" type="text/javascript"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="assets/scripts/core/app.js"></script>
<script src="assets/scripts/custom/components-editors.js"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script>
    jQuery(document).ready(function () {
        // initiate layout and plugins
        App.init();
        ComponentsEditors.init();
    });
    function addNote() {
        var noteContent = $('#noteContent').val();
        if ("" == noteContent) {
            parent.bootbox.alert("笔记内容不能为空！");
            return;
        }
        $.ajax({
            url: "note/addNote",
            data: {
                noteContent: noteContent,
                noteName: $("#noteName").val(),
                noteType: $('select').find('option:selected').val()
            },
            async: false,
            dataType: 'json',
            type: "post",
            success: function () {
                top.bootbox.alert("新增成功！");
                top.$("#tabDiv").find("iframe")[0].contentWindow[1].queryNote($('select').find('option:selected').val());
            }
        });
    }
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>